<template>
  <div class="page-container">
    <page_breadcrumb :getKeyMethod="init_table_model" @change="change_table_model" pageOption />

    <ex_super_table_page v-bind="option" ref="SuperTablePage" @selection-change="e => selection = e">

    </ex_super_table_page>



  </div>
</template>
<script>
import business_function from "@/common/business_function"

import moment from 'moment-mini-ts'
import superTablePageFunction from '@/mixin/super-table-page-function';
import page_table_model_manage from '@/mixin/page_table_model_manage';
export default {
  title: 'label_outbound_operate_record_report',
  mixins: [superTablePageFunction, page_table_model_manage],
  components: {},
  data() {
    return {
      option: {
        search: {
          default: {
            startTime: moment().subtract(3, 'days').set({ 'hours': 0, 'minutes': 0, 'seconds': 0, 'milliseconds': 0 }).valueOf(),
            endTime: moment().set({ 'hours': 23, 'minutes': 59, 'seconds': 59, 'milliseconds': 0 }).valueOf(),

            // daterange: [moment().set({ 'hours': 0, 'minutes': 0, 'seconds': 0, 'milliseconds': 0 }).subtract(3, 'months').valueOf(), moment().set({ 'hours': 23, 'minutes': 59, 'seconds': 59, 'milliseconds': 0 }).valueOf()]
          },
          model: [
            { key: 'trackNumber', label: 'label_face_track_code', },
            { key: 'startTime', label: 'label_start_time', type: 'date-picker', attrs: { type: "datetime", 'default-time': '00:00:00' } },
            { key: 'endTime', label: 'label_end_time', type: 'date-picker', attrs: { type: "datetime", 'default-time': '23:59:59' } },
          ],
        },
        actionExtra: [

          {
            label: 'label_export', click: this.exportExcel
          },

        ],
        table: {
          url: "/wms-api/outbound/OutboundOverseasOrderRpc/statOrderDetailReport.json",
          'cell-class-name': this.cellClassMethod,
          model: this.init_table_model(),
        },

      },


    };
  },
  methods: {
    cellClassMethod({ row, column, rowIndex, columnIndex }) {
      if (column.property == 'status') {
        if (row.status == 'SUCCESS') {
          return 'color_success'
        } else if (row.status == 'FAIL') {
          return 'color_danger'
        } else if (row.status == 'PARTIAL_SUCCESS') {
          return 'color_warning'
        } else if (row.status == 'IN_EXECUTION') {
          return 'color_primary'
        }
      }
      return ""
    },
    option_table_model() {
      return [
        // { type: 'selection', clickToggle: true, keyGroup: 'label_table_operate' },
        {
          type: 'expandDesc', 'width': 80,
          expandDesc: {
            ...this.$defaultDescAttrs,
            model: [],
          },
        },


        {
          key: 'orderCreateDate', label: 'label_WMS_order_create_time', 'width': 140, 
          formatter: (r, c, v, i) => this.$dateFormat(v),
        },
        {
          key: 'taskOrderPrintDate', label: 'label_WMS_pick_order_print_time', 'width': 140, 
          formatter: (r, c, v, i) => this.$dateFormat(v),
        },
        {
          key: 'pickUserName', label: 'label_PDA_pick_user', 'width': 130, 'show-overflow-tooltip': true,
        },
        {
          key: 'recommendLocation', label: 'label_recommend_location', 'width': 130, 'show-overflow-tooltip': true,
          // formatter: (r, c, v, i) => this.$dateFormat(v),
        },
        {
          key: 'pickDate', label: 'label_PDA_pick_time', 'width': 140, 
          formatter: (r, c, v, i) => this.$dateFormat(v),
        },

        {
          key: 'trackScanDate', label: 'label_track_scan_time', 'width': 140, 
          formatter: (r, c, v, i) => this.$dateFormat(v),

        },
        {
          key: 'packageOperationUser', label: 'label_pack_operate_account', 'width': 180, 'show-overflow-tooltip': true,
        },

        {
          key: 'packageOperationDate', label: 'label_pack_operate_time', 'width': 130, 'show-overflow-tooltip': true,
          // formatter: (r, c, v, i) => this.$dateFormat(v),
        },
        { key: 'orderStatus', label: 'label_order_status', 'width': 130, 'show-overflow-tooltip': true,
        formatter: (r, c, v, i) => this.$enumShow(v, "OutboundOrderStatusEunm"),
         },
        { key: 'trackNumber', label: 'label_face_track_code', 'width': 130, 'show-overflow-tooltip': true, },
        {
          key: 'actualPickLocation', label: 'label_actual_pick_location', 'width': 130, 'show-overflow-tooltip': true,
        },
        {
          key: 'supplierName', label: 'label_final_supplier', 'width': 130, 'show-overflow-tooltip': true,
        },
        {
          key: 'orderType', label: 'label_order_type', 'width': 130, 'show-overflow-tooltip': true,
        },

        {
          key: 'waybillSkuCount', label: 'label_order_inner_count_track_inner_count', 'width': 130, 'show-overflow-tooltip': true,
        },
        {
          key: 'skuInfo', label: 'label_sku_info', 'width': 130, 'show-overflow-tooltip': true,
        },
        {
          key: 'weight', label: 'label_actual_weight', 'width': 130, 'show-overflow-tooltip': true,
        },
        {
          key: 'volume', label: 'label_volume', 'width': 130, 'show-overflow-tooltip': true,
        },

        {
          key: 'customerCode', label: 'label_srm_api_request_customer_code', 'width': 130, 'show-overflow-tooltip': true,
        },
        {
          key: 'boxCreateDate', label: 'label_big_package_create_time', 'width': 130, 'show-overflow-tooltip': true,
          // formatter: (r, c, v, i) => this.$dateFormat(v),
        },
        { key: 'boxNo', label: 'label_big_package_code', 'width': 130, 'show-overflow-tooltip': true, },


        // {
        //   key: 'gmtCreate', label: 'label_create_time', 'width': 130, 'show-overflow-tooltip': true,
        //   formatter: (r, c, v, i) => this.$dateFormat(v),
        // },
        // {
        //   key: 'gmtModify', label: 'label_modify_time', 'width': 130, 'show-overflow-tooltip': true,
        //   formatter: (r, c, v, i) => this.$dateFormat(v),
        // },
      ]
    },
    exportExcel() {
      business_function.confirmOperateBaseSelectOrForm.call(this, {
        data: this.$refs.SuperTablePage.getSearchData(),
        model: this.option.search.model,
        callback: (selection, data) => {
          let params = data
          this.$functionCommon({
            url: "/wms-api/outbound/OutboundOverseasOrderRpc/exportOrderDetailExcel.json",
            system: 'wms',
            data: params,
          })
        }
      })

    },




  }
};

</script>
<style></style>
